//
//  HEAfterListFooterCell.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/11/16.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HEAfterListFooterCell.h"

@interface HEAfterListFooterCell ()

@end

@implementation HEAfterListFooterCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.backgroundColor = [UIColor clearColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
 
        [self initUI];
    }
    return self;;
}

- (void)initUI {
    
    UIView *warp = [UIView new];
    warp.backgroundColor = KWhiteColor;
    [self.contentView addSubview:warp];

    [warp mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).mas_offset(0);
        make.left.equalTo(self.contentView).mas_offset(10);
        make.right.equalTo(self.contentView).mas_offset(-10);
//        make.height.mas_greaterThanOrEqualTo(15);
        make.bottom.equalTo(self.contentView).mas_offset(0);
    }];
    [warp hg_setCornerOnBottomWithRadius:10.0f];
    
    UIView *footerLine = [UIView new];
    footerLine.backgroundColor = CSplitLineColor;
    [warp addSubview:footerLine];
    
    [footerLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(warp).mas_offset(10);
        make.height.mas_offset(1);
        make.left.equalTo(warp).mas_offset(15);
        make.right.equalTo(warp).mas_offset(-10);
    }];
    
    QMUIGhostButton *checkBtn = [[QMUIGhostButton alloc] initWithGhostColor:CNavBgColor];
    checkBtn.titleLabel.font = DYBlodFont(14);
    [checkBtn setTitle:@"立即查看" forState:UIControlStateNormal];
    [warp addSubview:checkBtn];
    [checkBtn addTarget:self action:@selector(checkClick) forControlEvents:UIControlEventTouchUpInside];
    
    [checkBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(footerLine.mas_bottom).mas_offset(10);
        make.right.equalTo(warp).mas_offset(-10);
        make.height.mas_equalTo(30);
        make.width.mas_equalTo([@"立即查看" widthForFont:DYBlodFont(14)] + 20);
        make.bottom.mas_equalTo(warp).offset(-10);
    }];
}

- (void)checkClick {
    if (self.oprationBlock) {
        self.oprationBlock();
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
